<html>

<head>
  <title>Insert/Edit Form</title>
  <link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
  <script type="text/javascript" src="../../../popups/popup.js"></script>

<script type="text/javascript">
    
var fields = ["f_name", "f_action", "f_method", "f_enctype", "custfun","custevent","cus_fun_Name"];

function Init() 
{
  __dlg_translate("Forms");
  __dlg_init(null,{width:400, height:250});
  var param = window.dialogArguments;
 	
  for (var i in fields) 
   {
    document.getElementById(fields[i]).value = param[fields[i]];
    
   }
  document.getElementById("f_name").focus();
}

  function onOK() 
  {
     var required = 
     {
     "f_name": "You must enter the form name"
    };
  
  for (var i in required)
  {
    var el = document.getElementById(i);
    
    if (!el.value) 
    {
      alert(Xinha._lc(required[i],"Forms"));
      el.focus();
      return false;
    }
  }
  // pass data back to the calling window
  var param = new Object();
  for (var i in fields) {
    param[fields[i]] = document.getElementById(fields[i]).value;
  }
  __dlg_close(param);
  return false;
 }

function onCancel() {
  __dlg_close(null);
  return false;
}
        
</script>
</head>

<body class="dialog" onload="Init()">
<div class="title">Form</div>
<form action="" method="get" >
  <div class="fr">Form Name:</div>
  <input type="text" name="name" id="f_name" size="20" title="Name" />
  <p />

  <fieldset>
  <legend>Form handler script</legend>
  <div class="space"></div>
  <div class="fr">Action URL:</div>
   <select name="action" id="f_action">      
    	<option selected="selected" value="MasterInsert">Insert</option>    
  </select>
    
  <p />
  <div class="fr">Method:</div>
  <select name="f_method" id="f_method">
    	<option selected="selected" value="post" >Post</option>
  </select>
  
  <div class="space"></div>
  <div class="fr">Encoding:</div>
  <select name="enctype" id="f_enctype">
    <option selected="selected" value = "application/x-www-form-urlencoded">HTML-Form to CGI (default)</option>
  </select>
  <p />  
  <p />
  </fieldset>
          <div id="customDiv" name="customDiv" >
              <fieldset>
                 <legend>Write JavaScript Function</legend>
                <table>
                    <tr align="left">
                        <td >
                            Select form event:
                            <select name="custevent" id="custevent">
                                  <option value="onclick">onclick</option>
                                  <option value="ondblclick">ondblclick</option>
                                  <option value="onkeydown">onkeydown</option>
                                  <option value="onkeypress">onkeypress  </option>
                                  <option value="onkeyup">onkeyup </option>
                                  <option value="onmousedown">onmousedown</option>
                                  <option value="onmousemove">onmousemove</option>
                                  <option value="onmouseout" >onmouseout</option>
                                  <option value="onmouseover">onmouseover </option>
                                  <option value="onmouseup">onmouseup </option>
                                  <option value="onreset">onreset</option>
                                  <option value="onreset">onsubmit</option>
                              </select>    
                        </td>
                        <td>
                           Write a functionName:
                            <input id="cus_fun_Name" name="cus_fun_Name" type="text">                            
                        </td>
                    </tr>                    
                    <tr align="left" >                
                        <td colspan="2">
                             Write Function body here                       
                            <textarea id="custfun" name="custfun" style="width:350 ; height:150"> </textarea>        
                        </td>                                          
                    </tr>
                </table>                     
          </fieldset>
        </div>

<div id="buttons">
  <button type="button" name="ok" onclick="return onOK();">OK</button>
  <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
</div>
</form>

</body>
</html>
